import Vue from 'vue'
import Router from 'vue-router'
import box from '@/pages/box'

// 首页
import home from '@/pages/home'
// 资讯详情
import infoDetails from '@/pages/infoDetails'
// 支付成功
import paySuccess from '@/pages/paySuccess'

// 测试
// 成人测试
import examAdult from '@/pages/exam/examAdult'
// 少年测试
import examJuvenile from '@/pages/exam/examJuvenile'
// 确认订单
import examOrder from '@/pages/exam/examOrder'
// 开始测试
import examStart from '@/pages/exam/examStart'
// 结果生成中
import examResulting from '@/pages/exam/examResulting'
// 测试结果
import examResult from '@/pages/exam/examResult'
// 孩子测试结果
import examResultChild from '@/pages/exam/examResultChild'

// 门店
// 门店首页
import store from '@/pages/store/store'
// 门店搜索
import storeSearch from '@/pages/store/storeSearch'
// 门店详情
import storeDetails from '@/pages/store/storeDetails'
// 立即预约
import appoint from '@/pages/store/appoint'
// 预约完成
import appointComplete from '@/pages/store/appointComplete'

// 商品首页
// 商城
import goods from '@/pages/goods/goods'
// 商品列表
import goodsList from '@/pages/goods/goodsList'
// 购物车
import cart from '@/pages/goods/cart'
// 商品详情
import goodsDetails from '@/pages/goods/goodsDetails'
// 确认订单
import confirmOrder from '@/pages/goods/confirmOrder'

// 个人中心
// 个人中心首页
import person from '@/pages/personal/person'
// 绑定手机
import bindPhone from '@/pages/personal/bindPhone'
// 充值
import recharge from '@/pages/personal/recharge'
// 充值
import rechargeSucess from '@/pages/personal/rechargeSucess'
// 充值规则协议
import rechargeAgree from '@/pages/personal/rechargeAgree'
// 订单
import order from '@/pages/personal/order'
// 订单详情
import orderDetails from '@/pages/personal/orderDetails'
// 邀请收益
import invite from '@/pages/personal/invite'
// 提现
import inviteEarn from '@/pages/personal/inviteEarn'
// 我的邀请
import myInvite from '@/pages/personal/myInvite'
// 我的预约
import myAppoint from '@/pages/personal/myAppoint'
// 充值记录
import rechargeList from '@/pages/personal/rechargeList'
// 测试结果
import myExam from '@/pages/personal/myExam'

Vue.use(Router)

export default new Router({
  // mode: 'history',
  routes: [{
    path: '/',
    component: box,
    children: [{
      path: '/',
      meta: {
        title: '首页'
      },
      component: home
    }, {
      path: '/store',
      meta: {
        title: '门店'
      },
      component: store
    }, {
      path: '/goods',
      meta: {
        title: '商城'
      },
      component: goods
    }, {
      path: '/person',
      meta: {
        title: '我的'
      },
      component: person
    }]
  }, {
    path: '/infoDetails',
    meta: {
      title: '最新资讯'
    },
    component: infoDetails
  }, {
    path: '/paySuccess',
    meta: {
      title: '支付成功'
    },
    component: paySuccess
  }, {
    path: '/examAdult',
    meta: {
      title: '支付成功'
    },
    component: examAdult
  }, {
    path: '/examJuvenile',
    meta: {
      title: '少年测试'
    },
    component: examJuvenile
  }, {
    path: '/examStart',
    meta: {
      title: '开始测试'
    },
    component: examStart,
  }, {
    path: '/examResulting',
    meta: {
      title: '结果生成中'
    },
    component: examResulting,
  }, {
    path: '/examResult',
    meta: {
      title: '测试结果'
    },
    component: examResult,
  }, {
    path: '/examResultChild',
    meta: {
      title: '测试结果'
    },
    component: examResultChild,
  }, {
    path: '/examOrder',
    meta: {
      title: '确认订单'
    },
    component: examOrder
  }, {
    path: '/storeSearch',
    meta: {
      title: '门店搜索'
    },
    component: storeSearch
  }, {
    path: '/storeDetails',
    meta: {
      title: '门店详情'
    },
    component: storeDetails
  }, {
    path: '/appoint',
    meta: {
      title: '立即预约'
    },
    component: appoint
  }, {
    path: '/appointComplete',
    meta: {
      title: '预约完成'
    },
    component: appointComplete
  }, {
    path: '/goodsList',
    meta: {
      title: '商城'
    },
    component: goodsList
  }, {
    path: '/cart',
    meta: {
      title: '购物车'
    },
    component: cart
  }, {
    path: '/goodsDetails',
    meta: {
      title: '商品详情'
    },
    component: goodsDetails
  }, {
    path: '/confirmOrder',
    meta: {
      title: '确认订单'
    },
    component: confirmOrder
  }, {
    path: '/bindPhone',
    meta: {
      title: '绑定手机号'
    },
    component: bindPhone
  }, {
    path: '/recharge',
    meta: {
      title: '充值'
    },
    component: recharge
  }, {
    path: '/rechargeSucess',
    meta: {
      title: '充值'
    },
    component: rechargeSucess
  }, {
    path: '/rechargeAgree',
    meta: {
      title: '充值规则协议'
    },
    component: rechargeAgree
  }, {
    path: '/order',
    meta: {
      title: '订单'
    },
    component: order
  }, {
    path: '/orderDetails',
    meta: {
      title: '订单详情'
    },
    component: orderDetails
  }, {
    path: '/invite',
    meta: {
      title: '邀请收益'
    },
    component: invite
  }, {
    path: '/inviteEarn',
    meta: {
      title: '提现'
    },
    component: inviteEarn
  }, {
    path: '/myInvite',
    meta: {
      title: '我的邀请'
    },
    component: myInvite
  }, {
    path: '/myAppoint',
    meta: {
      title: '我的预约'
    },
    component: myAppoint
  }, {
    path: '/rechargeList',
    meta: {
      title: '充值记录'
    },
    component: rechargeList
  }, {
    path: '/myExam',
    meta: {
      title: '测试结果'
    },
    component: myExam
  }],
  scrollBehavior(to, from, savedPosition) {
    return {
      x: 0,
      y: 0
    }
  }
})